package com.realone.packman.codec.decoder;

import com.realone.packman.codec.decoder.vo.BmsDecoderDataVo15;
import com.realone.packman.codec.exception.BmsDecoderException;

import java.nio.ByteBuffer;

/**
 * 获取BMS湿度 解码
 *
 * @author hugx
 * @create 2018-09-14 14:31
 */
public class BmsDecoder15 extends BmsDecoder<BmsDecoderDataVo15> implements BmsDecoderStrategy {

    public BmsDecoder15(Integer classType) {
        this.classType = classType;
    }

    @Override
    public BmsDecoderDataVo15 decoderBody(ByteBuffer bb) {
        if (bb == null) {
            throw new BmsDecoderException(new NullPointerException());
        }

        BmsDecoderDataVo15 result = new BmsDecoderDataVo15(this.classType);
        /*解析 获取BMS湿度 */
        result.setHumidity(bb.get());

        /* 解析 电池仓温度值 */
        result.setTemperature((char) bb.get());

        return result;
    }


}
